package lbim.client.ui;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/**
 *
 * @author tharindu
 */
public class Splash extends Canvas {

    private Image image;

    public Splash() {
        try {
            image = Image.createImage("/spl.png");
        } catch (Exception e) {
            System.out.println("[Splash] Splash() Image NOT loaded");
            e.printStackTrace();
        }
    }

    public void paint(Graphics g) {
        //Draw rectangle for background
        g.setColor(0X00aff0);
        g.fillRect(0, 0, getWidth(), getHeight());
        try {
            g.drawImage(image, getWidth() / 2, getHeight() / 2, Graphics.HCENTER | Graphics.VCENTER);
        } catch (Exception e) {
            g.setColor(0Xffffff);
            g.setFont(Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_LARGE));
            g.drawString("Please Wait..", getWidth()/2 , getHeight()/2 +5, Graphics.HCENTER | Graphics.TOP);
        }
    }

}
